ASM

[Special] - Inserts assembly code


Syntax:

ASM

<Any Assembly code>

END ASM

Parameters:

none

Description:

Starts immediate inline assembly using standard cpu opcodes. Use with caution.

Examples:

FUNCTION FASTCALL whatLetter (A AS UBYTE) AS UBYTE
ASM
JP START
DATA:
DEFB "A Man, A Plan, A Canal, Panama"
START:
LD HL,DATA
LD E, A
LD D, 0
ADD HL, DE
LD A, (HL)
END ASM
END FUNCTION

The first example will move compilation forward to match the next multiple of 256 bytes. This is useful in machine code routines as it matches a new "high byte" position in memory. That is to say that the data can be addressed by address ??00 - the low byte will be zero. This is often a key optimization for data tables and screen addressing routines.

Aligning to a 16K (16384) boundary might be useful in 128K programming.

Notes:

See also:

ALIGN, END ASM


Supported Plattforms:

ZX Spectrum